<?php
header("Content-Type:text/html; charset=utf-8");
require_once("../connectMysql/connetMysql.class.php");
$db=new connetMysql;
$con=$db->getConnect();
date_default_timezone_set('prc');
//echo "hello";
$time=date('Y-m-d H:i:s',time());
//echo "$time"."<br />";
$title=$_POST["news_title"];
$content=$_POST["news_content"];
$news_pic =$_POST["display_filename"];
if($news_pic==""){
	$sql="INSERT INTO newsdraft (newstitle, newscontent, newssubmittime,newsname)  VALUES    ('$title','$content','$time','1')";
	if (!mysqli_query($con,$sql))
  	{
  		die('Error: ' . mysqli_error());
 	}
	echo "1 record added";
}
else{
	$news_pic ="news_tougao/uploadpics/".$_POST["display_filename"];
	$sql="INSERT INTO newsdraft (newstitle, newscontent, newssubmittime,newspic,newsname) VALUES  ('$title','$content','$time','$news_pic','1')";

	if (!mysqli_query($con,$sql))
  	{
 	 die('Error: ' . mysqli_error());
 	 }
	echo "1 record added";
}
mysqli_close($con)
?>